package com.ruoyi.basedata.service;

import java.util.List;

import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.basedata.domain.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basedata.domain.vo.ElectricityTerminalsXbProtocol;
import com.ruoyi.basedata.domain.vo.TerminalsXbProtocol;
import com.ruoyi.basedata.wxentity.AreaTreeTerminalInfo;

/**
 * 电档案Service接口
 *
 * @author gdqt
 * @date 2025-03-06
 */
public interface    IElectricityTerminalsXbService extends IService<ElectricityTerminalsXb>
{
    /**
     * 千宝通通协议id
     */
    String QIANBAOTONG_PROTOCOL_ID = "8";
    /**
     * 查询小档案
     *
     * @param ID 小档案主键
     * @return 小档案
     */
    public ElectricityTerminalsXb selectTerminalsXbByID(Long ID);

    /**
     * 查询小档案列表
     *
     * @param terminalsXb 小档案
     * @return 小档案集合
     */
    public List<ElectricityTerminalsXb> selectTerminalsXbList(ElectricityTerminalsXb terminalsXb);
    public List<ElectricityTerminalsXb> selectTerminalsXbListAll(ElectricityTerminalsXb terminalsXb);

    /**
     * 查询协议
     *
     * @param terminalsXb
     * @return
     */
    List<ElectricityTerminalsXbProtocol> selectTerminalsXbProtocolList(ElectricityTerminalsXb terminalsXb);

    /**
     * 新增小档案
     *
     * @param terminalsXb 小档案
     * @return 结果
     */
    public String insertTerminalsXb(ElectricityTerminalsXb terminalsXb);

    /**
     * 修改小档案
     *
     * @param terminalsXb 小档案
     * @return 结果
     */
    public String updateTerminalsXb(ElectricityTerminalsXb terminalsXb);

    /**
     * 批量删除小档案
     *
     * @param IDs 需要删除的小档案主键集合
     * @return 结果
     */
    public int deleteTerminalsXbByIDs(Long[] IDs) throws Exception;

    /**
     * 删除小档案信息
     *
     * @param ID 小档案主键
     * @return 结果
     */
    public int deleteTerminalsXbByID(Long ID);


    List<ElectricityTerminalsXb> selectlistNoBound();

    int logout(Long id);

    List<ElectricityTerminalsXb> selectListByAreaCode(String treeAreaCode);

    List<ElectricityTerminalsXb> selectListByLdId(String treeLdId);

    String importUser(List<ElectricityTerminalsXb> userList, boolean updateSupport, String operName);

    ElectricityTerminalsXbProtocol getcreateCommandParm(Integer commandType, String isOpen, ElectricityTerminalsXbProtocol terminalsXbProtocol);

    boolean sendCreateCommand(JSONObject jsonObject, String appKey, String appSecret, String MasterKey) throws Exception;

    boolean sendCreateCommandInOneNet(ElectricityTerminalsXbProtocol terminalsXbProtocol,String payload);

    JSONObject queryCommand(String appKey, String appSecret, String MasterKey, String commandId, String deviceId) throws Exception;

    JSONObject createGuoXinDeviceInAep(String appKey, String appSecret, String MasterKey, ElectricityTerminalsXb terminalsXb);

    JSONObject createDeviceInOneNet(ElectricityTerminalsXb terminalsXb);

    String importDeviceInAep(List<ElectricityTerminalsXb> terminalsXbList) throws Exception;

    JSONObject deleteGuoXinDeviceInAep(String appKey, String appSecret, String MasterKey, List<String> deviceIds, String productId) throws Exception;

    JSONObject queryDeviceList(String appKey, String appSecret, String MasterKey, String IMEI);

    JSONObject queryDeviceList2(ElectricityTerminalsXb terminalsXb);

    List<AreaTreeTerminalInfo> searchTerminalXB(ElectricityTerminalsXb terminalsXb);

    List<ElectricityTerminalsXb> selectTerminalsXbBySheetsCode(String sheetsCode);

    boolean cancelTerminal(ElectricityTerminalsXb terminalsXb, String operator);

    /**
     * 查询小档案列表
     *
     * @param terminalsXb 小档案
     * @return 小档案
     */
    List<TerminalsXbRGView> selectTerminalsXbListAndRealtimegatherdata(ElectricityTerminalsXb terminalsXb);

    ElectricityTerminalsXb selectTerminalsXbByTerminalID(String terminalId);

    ElectricityTerminalsXb getByLocationNb(String locationNb);

    boolean changeTerminalXb(ElectricityTerminalsXb terminalsXb);

    void updateAllLocationNb();

    void updateDeviceId(ElectricityTerminalsXb terminalsXb);

    /**
     * 小表过户
     *
     * @param usersXb    新的小表用户档案
     * @param terminalId 小表id
     * @param newUser 是否新建用户
     * @return 是否过户成功
     */
    boolean changeTerminalUser(ElectricityUsersXb usersXb, String terminalId, boolean newUser);

    /**
     * 更新redis缓存
     * @param xb 条件
     * @return boolean
     */
    boolean updateRedisCache(ElectricityTerminalsXb xb);

    /**
     * 批量更新小表档案及用户信息
     *
     * @param list 小表档案及用户信息
     * @return 是否成功
     */
    boolean batchUpdateTerminalsXb(List<BatchUpdateTerminalsXb> list);
}
